<template>
  <div class="box">
    <h1>Child:{{ count }}</h1>
    <!-- button进行双向数据绑定 -->
    <button @click="$emit('update:count', count + 1)">修改count</button>

    <!-- input进行双向数据绑定 -->
    <input
      type="text"
      :value="count"
      @input="$emit('update:count', $event.target.value)"
    />
  </div>
</template>

<script>
export default {
  name: "Child",
  props: ["count"],
};
</script>

<style scoped>
.box {
  background: yellowgreen;
}
</style>
